package com.woniuxy.ssm.powermag.mapper;

import com.woniuxy.ssm.entity.DeptEntity;
import com.woniuxy.ssm.entity.RoleEntity;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.Date;
import java.util.List;

public interface RoleMapper {
    void save(@Param("d") RoleEntity roleEntity);

    void update(@Param("d")RoleEntity roleEntity);

    @Delete("delete from role_info where id = #{id}")
    void deleteById(Long id);


    @Results({
            @Result(id=true,property = "id",column = "id",javaType = Long.class),
            @Result(property = "roleName",column = "role_name",javaType = String.class),
            @Result(property = "roleDesc",column = "role_desc",javaType = String.class),
            @Result(property = "createTime",column = "create_time",javaType = Date.class)
    })
    @Select("select * from role_info where id = #{id}")
    RoleEntity getById(Long id);

    List<RoleEntity> page(@Param("d") RoleEntity roleEntity);

}
